home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1987, 1988, 1989 Stanford University
- Copyright (c) 1989, Tera Computer Company
- **/
-
- #ifndef istring_h
- #define istring_h
-
- #include <string.h>
-
- // strdup allocates and returns a duplicate of the given string.
-
- //inline char* strdup (const char* s) {
- // char* dup = new char[strlen(s) + 1];
- // strcpy(dup, s);
- // return dup;
- //}
-
- //char* strdup (const char* s);
-
- // strndup allocates and returns a duplicate of the first len
- // characters of the given string.
-
- inline char* strndup (const char* s, int len)
- {
- char* dup = new char[len + 1];
- strncpy(dup, s, len);
- dup[len] = '\0';
- return dup;
- }
-
- #endif
-